Page({
  data: {
  indexlist:["男装","女装","零食","生活家电","床上用品","家具"],
  bannerlist:[{
    url:"../../images/banner1.jpg"
  },{
    url:"../../images/banner2.jpg"
  },{
    url:"../../images/banner3.jpg"
  }
],
danmulist:[
  {
      text:"网院",
      color:"#ff0000",
      time:1
},{
  text:"电大",
  color:"#E64E69",
  time:3
}],
likes:[],
latitude:"",
longittude:""
  },
  checkboxChange(e){

    var than = this;
    console.log(e);
    than.setData({likes:e.detail.value})
    let data = than.data.likes
    console.log(data);
  },
  saveUserInfo(){
    var data = {"name":"小明","student_id":"201965110443"}
    wx.setStorageSync('userinfo', data)

    //异步
    wx.setStorage({
      data: {
        "sex":"男","age":19
      },
      key: 'studentinfo',
    })
  },
  getUserInfo(){
    //同步获取缓存数据
    var userinfo = wx.getStorageSync('userinfo')
    console.log(userinfo);
    //异步
    wx.getStorage({
      key: 'userinfo',
      success(res){
        console.log(res);
      }
    })
    wx.getStorageInfo({
      success: (option) => {
        console.log(option)
      },
    })

  },
  removeUserInfo(){

    //异步删除
    wx.removeStorage({
      key: 'userinfo',
    })
    //同步删除
    wx.removeStorageSync('studentinfo')

  },
  getLocal(){
    var then = this
      wx.getLocation({
        type:"gcj02",
        success(res){
            console.log(res);
            then.setData({
              latitude:res.latitude,
              longittude:res.longitude
            })
        }
      })
  },
  openMap(){
    var then = this;
    wx.openLocation({
      latitude: then.data.latitude,
      longitude: then.data.longittude,
      name:"湖南开放大学1104",
      address:"湖南长沙市天心区清源路168号1104"
    })
  },
  selsectLocal(){
    var then = this;
      wx.chooseLocation({
        latitude: then.data.latitude,
        longitude:then.data.longittude
      })
  },
  call(){
    wx.makePhoneCall({
      phoneNumber: '17752718972',
    })
  },
  scanCode(){

    wx.scanCode({
      onlyFromCamera: true,
      success(res){
          console.log(res);
      }
    })
  },
  onLoad() {
   
  }
})
